<template>
  <div>
    <div class="form">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="商城名称" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="商城地址" prop="name">
          <el-input v-model="ruleForm.address"></el-input>
        </el-form-item>
        <el-form-item label="地理坐标">
          <el-col :span="11">
            <el-input v-model="ruleForm.longitude" placeholder="经度"></el-input>
          </el-col>
          <el-col class="line" :span="2">-</el-col>
          <el-col :span="11">
            <el-input v-model="ruleForm.latitude" placeholder="纬度"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="联系电话" prop="name">
          <el-input v-model="ruleForm.phone"></el-input>
        </el-form-item>
        <el-form-item label="联系QQ" prop="name">
          <el-input v-model="ruleForm.qq"></el-input>
        </el-form-item>
        <el-form-item label="" prop="name">
          <el-row>
            <el-button>取消</el-button>
            <el-button type="primary" @click="change">确定</el-button>

          </el-row>
        </el-form-item>

      </el-form>
    </div>
  </div>
</template>

<script>
import { yonghu,yonghu2 } from '@/api/pzgl/scpz.js';
import { mount } from '@vue/test-utils';
export default {
  data() {
    return {
      ruleForm: {
        address: '',
        latitude: '',
        longitude: '',
        name: '',
        phone: '',
        qq: '',

      },
      rules: {
        name: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
          { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
        ],
      }
    }
  },
  mounted() {
    this.getlist()
    
  },
  methods: {
    change(){
      yonghu2({
        litemall_mall_address:this.ruleForm.address,
        litemall_mall_latitude:this.ruleForm.latitude,

        litemall_mall_longitude:this.ruleForm.longitude,
        litemall_mall_name:this.ruleForm.name,
        litemall_mall_phone:this.ruleForm.phone,
        litemall_mall_qq:this.ruleForm.qq

      })
      .then((res) =>{
        console.log(res);
        
      })

    },
    getlist(){
      yonghu()
        .then((res) => {
          console.log(res);
          this.ruleForm.address=res.data.litemall_mall_address
          this.ruleForm.latitude=res.data.litemall_mall_latitude
          this.ruleForm.longitude=res.data.litemall_mall_longitude
          this.ruleForm.name=res.data.litemall_mall_name
          this.ruleForm.phone=res.data.litemall_mall_phone
          this.ruleForm.qq=res.data.litemall_mall_qq
        })
    }
  }
}
</script>

<style scoped>
</style>